<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>发帖</title>
    <Link rel="stylesheet" type="text/css" href="style/style.css" />
    <Link rel="stylesheet" type="text/css" href="style/index.css" />
    <script src="http://47.106.66.89:8080/js/vue.min.js"></script>
    <script src="http://47.106.66.89:8080/js/axios.min.js"></script>
    <link href="http://47.106.66.89:8080/js/ele-2.15.7/theme-chalk/index.css" rel="stylesheet">
    <script src="http://47.106.66.89:8080/js/ele-2.15.7/index.js"></script>
    <script src="js/bbs.js"></script>
    <script src="js/ueditor-1.4.3.3/ueditor.config.js"></script>
    <script src="js/ueditor-1.4.3.3/editor_api.js"></script>
    <style>
        .edui-default{line-height:20px}
    </style>


</head>
<body>
<div id="app">
    <bbs>
        <el-form ref="form" label-width="80px" style="width: 100%">
            <el-form-item label="回复标题:">
                <el-input v-model="retopic.title"></el-input>
            </el-form-item>
            <el-form-item label="帖子内容">
                <script id="container" name="content" type="text/plain">{{retopic.contents}}</script>
            </el-form-item>
            <el-form-item style="text-align: right">
                <el-button type="primary" @click="post">回帖</el-button>
                <el-button>取消</el-button>
            </el-form-item>
        </el-form>
    </bbs>
</div>
</body>
<script>
    var v = new Vue({
        el : "#app",
        data : {
            ue:null,
            retopic:{
                title:"",
                content:""
            }
        },
        created() {
            this.ue = UE.getEditor("container");
        },
        methods : {
            post(){
                // json 格式提交post请求
                this.retopic.content = this.ue.getContent();
                axios.get("reply/replyTopic"+location.search,{
                    params : this.retopic
                }).then(res=>{
                    if (res.data.code == 1) {
                        this.$message("发帖成功!");
                        // location.href = "list.html?bid=" + this.topic.boardid
                    }else{
                        this.$alert(res.data.msg)
                    }
                })
            }
        }
    })
</script>
</html>